﻿
#cmake 最低版本要求
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

#程序名称
PROJECT(TestDemo)

#编译方式DEBUG/RELEASE
SET(CMAKE_BUILD_TYPE DEBUG)

#编译参数
SET(CMAKE_C_FLAGS_DEBUG "-o0 -Wall -ggdb -rdynamic -Werror")
SET(CMAKE_CXX_FLAGS_DEBUG "-o0 -Wall -ggdb -rdynamic -Werror -std=c++11")

#ASIO 编译成库使用，不依赖BOOST
ADD_DEFINITIONS(-DASIO_STANDALONE -DASIO_DYN_LINK)

SET(RCF_ROOT 					${CMAKE_SOURCE_DIR})
SET(BIN_PATH 					${CMAKE_SOURCE_DIR}/bin)

SET(EXECUTABLE_OUTPUT_PATH 		${BIN_PATH} )
SET(LIBRARY_OUTPUT_PATH 		${BIN_PATH} )

SET(ASIO_ROOT 				${RCF_ROOT})
SET(ASIO_INCLUDES 			${ASIO_ROOT}/include
							${ASIO_ROOT}/asio
)

SET(RCF_INCLUDES ${ASIO_INCLUDES})

SET(RCF_LIBS 	ssl
		crypto
		rt
		m
		pthread
		z
		dl
)


INCLUDE_DIRECTORIES( ${RCF_INCLUDES})

LINK_DIRECTORIES( 			${BIN_PATH}
       						${LIBS_PATHS}
						)

AUX_SOURCE_DIRECTORY(${RCF_ROOT}/src ASIO_SRC_TO_BUILD)

##生成目标库
ADD_LIBRARY(asio STATIC ${ASIO_SRC_TO_BUILD})

ADD_EXECUTABLE(server ${RCF_ROOT}/src/examples/cpp11/ssl/server.cpp)

ADD_EXECUTABLE(client ${RCF_ROOT}/src/examples/cpp11/ssl/client.cpp)

TARGET_LINK_LIBRARIES(asio ${RCF_LIBS})

TARGET_LINK_LIBRARIES(server asio)

TARGET_LINK_LIBRARIES(client asio)
